
class A(object):
    def __init__(self):
        self.num=1
    def info_print(self):
        print(self.num)

class B(A):
    pass

result = B()
result.info_print()

class Master(object):
    def __init__(self):
        self.kongfu = '[古法煎饼果子配方]'
    def make_cake(self):
        print(f'运用{self.kongfu}制作煎饼果子')

class Prentice(Master):
    pass

daqiu= Prentice('黄腾轩')
print(daqiu.kongfu)
daqiu.make_cake()

class School(object):
    def __init__(self):
        self.kongfu = '[新式煎饼果子配方]'

    def make_cake(self):
        print(f'运用{self.kongfu}制作煎饼果子')

class Prentice(Master,School):
    def __init__(self):
        self.kongfu = '[独创煎饼果子配方]'
    def make_cake(self):
        self.__init__()
        print(f'运用{self.kongfu}制作煎饼果子')
    def make_master_cake(self):
        Master.__init__(self)
        Master.make_cake(self)
    def make_school_cake(self):
        School.__init__(self)
        School.make_cake(self)

class Tusun(Prentice):
    pass
# daqiu = Prentice()
# daqiu.make_cake()
# daqiu.make_master_cake()
# daqiu.make_school_cake()
xiaoqiu = Tusun()
xiaoqiu.make_cake()
xiaoqiu.make_school_cake()
xiaoqiu.make_master_cake()


class Master:
    def __init__(self):
        self.kongfu = "姜饼果子配方"

    def make_cake(self):
        print(f"运用{self.kongfu}制作煎饼")


class School(Master):
    def __init__(self):
        super().__init__()
        self.kongfu = "姜饼果子新配方"

    def make_cake(self):
        super().make_cake()
        print(f"接着运用{self.kongfu}制作煎饼")


class Prentice(School):
    def __init__(self):
        super().__init__()
        self.kongfu = "独创配方"

    def make_cake(self):
        print(f"运用{self.kongfu}制作煎饼")

    def make_master_cake(self):
        # 假设我们想要以 Master 类的配方制作蛋糕，但保持当前对象的 kongfu 属性不变
        # 这通常不是通过直接调用 __init__ 实现的，但可以通过设置临时属性或传递参数来实现
        original_kongfu = self.kongfu
        self.kongfu = "姜饼果子配方"  # 临时设置回 Master 的配方
        Master.make_cake(self)  # 直接调用 Master 类的 make_cake 方法
        self.kongfu = original_kongfu  # 恢复原来的 kongfu 属性

    def make_school_cake(self):
        # 直接调用 School 类的 make_cake 方法
        School.make_cake(self)



class Tusun(Prentice):
    pass


# 测试
t = Tusun()
t.make_cake()  # 输出：运用独创配方制作煎饼
t.make_master_cake()  # 输出：运用姜饼果子配方制作煎饼
t.make_school_cake()  # 输出：运用姜饼果子配方制作煎饼，接着运用姜饼果子新配方制作煎饼
class A(object):


def __init__(self):
        print('class----A----')

class B(A):
    def __init__(self):
        print('class----B----')
        super(B,self).__init__()

class C(A):
    def __init__(self):
        print('class----C----')
        super(C,self).__init__()

class D(B,C):
    def __init__(self):
        print('class----D----')
        super(D,self).__init__()

d = D()

